home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / boxes / demo2 / aboutbox.txt (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-04-19  |  10.1 KB  |  343 lines

  1. VERSION 2.00
  2. Begin Form FAB 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "About APPNAME"
  6.    ClientHeight    =   4470
  7.    ClientLeft      =   1665
  8.    ClientTop       =   1335
  9.    ClientWidth     =   6240
  10.    FillColor       =   &H00FFFFFF&
  11.    Height          =   4875
  12.    Icon            =   ABOUTBOX.FRX:0000
  13.    Left            =   1605
  14.    LinkTopic       =   "Form2"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   4470
  18.    ScaleWidth      =   6240
  19.    Top             =   990
  20.    Width           =   6360
  21.    Begin PictureBox IconPicture 
  22.       AutoSize        =   -1  'True
  23.       BorderStyle     =   0  'None
  24.       Height          =   480
  25.       Left            =   240
  26.       ScaleHeight     =   480
  27.       ScaleWidth      =   480
  28.       TabIndex        =   1
  29.       Top             =   240
  30.       Width           =   480
  31.    End
  32.    Begin CommandButton CommandOK 
  33.       Cancel          =   -1  'True
  34.       Caption         =   "OK"
  35.       Default         =   -1  'True
  36.       Height          =   495
  37.       Left            =   5040
  38.       TabIndex        =   0
  39.       Top             =   120
  40.       Width           =   1095
  41.    End
  42.    Begin Label Label1 
  43.       Alignment       =   2  'Center
  44.       BackColor       =   &H00C0C0C0&
  45.       Caption         =   "AOL:  StevenG400"
  46.       Height          =   255
  47.       Left            =   960
  48.       TabIndex        =   20
  49.       Top             =   4110
  50.       Width           =   4455
  51.    End
  52.    Begin Label MyInfoLabel 
  53.       Alignment       =   2  'Center
  54.       Caption         =   "CompuServe:  Steven Gotz  70563,207"
  55.       Height          =   255
  56.       Left            =   960
  57.       TabIndex        =   19
  58.       Top             =   3840
  59.       Width           =   4455
  60.    End
  61.    Begin Label OptLabel 
  62.       BorderStyle     =   1  'Fixed Single
  63.       Height          =   30
  64.       Index           =   5
  65.       Left            =   960
  66.       TabIndex        =   18
  67.       Top             =   2040
  68.       Width           =   4335
  69.    End
  70.    Begin Label OptLabel 
  71.       BorderStyle     =   1  'Fixed Single
  72.       Height          =   30
  73.       Index           =   2
  74.       Left            =   960
  75.       TabIndex        =   17
  76.       Top             =   1320
  77.       Width           =   4335
  78.    End
  79.    Begin Label OptLabel 
  80.       Caption         =   "FSRs"
  81.       Height          =   255
  82.       Index           =   14
  83.       Left            =   3120
  84.       TabIndex        =   16
  85.       Top             =   3360
  86.       Width           =   2295
  87.    End
  88.    Begin Label OptLabel 
  89.       Caption         =   "System Resources:"
  90.       Height          =   255
  91.       Index           =   13
  92.       Left            =   960
  93.       TabIndex        =   15
  94.       Top             =   3360
  95.       Width           =   2055
  96.    End
  97.    Begin Label OptLabel 
  98.       Caption         =   "Dos Version"
  99.       Height          =   255
  100.       Index           =   7
  101.       Left            =   960
  102.       TabIndex        =   14
  103.       Top             =   2400
  104.       Width           =   2295
  105.    End
  106.    Begin Label OptLabel 
  107.       Caption         =   "Win Version"
  108.       Height          =   255
  109.       Index           =   6
  110.       Left            =   960
  111.       TabIndex        =   13
  112.       Top             =   2160
  113.       Width           =   2175
  114.    End
  115.    Begin Label OptLabel 
  116.       Caption         =   "Math Coproc"
  117.       Height          =   255
  118.       Index           =   12
  119.       Left            =   3120
  120.       TabIndex        =   12
  121.       Top             =   3120
  122.       Width           =   2175
  123.    End
  124.    Begin Label OptLabel 
  125.       Caption         =   "Math Co-processor:"
  126.       Height          =   255
  127.       Index           =   11
  128.       Left            =   960
  129.       TabIndex        =   11
  130.       Top             =   3120
  131.       Width           =   2055
  132.    End
  133.    Begin Label OptLabel 
  134.       Caption         =   "Memory"
  135.       Height          =   255
  136.       Index           =   10
  137.       Left            =   3120
  138.       TabIndex        =   10
  139.       Top             =   2880
  140.       Width           =   2175
  141.    End
  142.    Begin Label OptLabel 
  143.       Caption         =   "Memory:"
  144.       Height          =   255
  145.       Index           =   9
  146.       Left            =   960
  147.       TabIndex        =   9
  148.       Top             =   2880
  149.       Width           =   2055
  150.    End
  151.    Begin Label OptLabel 
  152.       Caption         =   "Win Mode"
  153.       Height          =   255
  154.       Index           =   8
  155.       Left            =   960
  156.       TabIndex        =   8
  157.       Top             =   2640
  158.       Width           =   4335
  159.    End
  160.    Begin Label NameLabel 
  161.       Caption         =   "Name Label"
  162.       Height          =   255
  163.       Left            =   960
  164.       TabIndex        =   2
  165.       Top             =   120
  166.       Width           =   4275
  167.    End
  168.    Begin Label OptLabel 
  169.       Caption         =   "Company Name"
  170.       Height          =   255
  171.       Index           =   4
  172.       Left            =   960
  173.       TabIndex        =   7
  174.       Top             =   1680
  175.       Width           =   4275
  176.    End
  177.    Begin Label OptLabel 
  178.       Caption         =   "User Name"
  179.       Height          =   255
  180.       Index           =   3
  181.       Left            =   960
  182.       TabIndex        =   6
  183.       Top             =   1440
  184.       Width           =   4275
  185.    End
  186.    Begin Label OptLabel 
  187.       Caption         =   "Extra 2"
  188.       Height          =   255
  189.       Index           =   1
  190.       Left            =   960
  191.       TabIndex        =   5
  192.       Top             =   1020
  193.       Width           =   4275
  194.    End
  195.    Begin Label OptLabel 
  196.       Caption         =   "Extra 1"
  197.       Height          =   255
  198.       Index           =   0
  199.       Left            =   960
  200.       TabIndex        =   4
  201.       Top             =   720
  202.       Width           =   4275
  203.    End
  204.    Begin Label CoprLabel 
  205.       Caption         =   "Copyright Label"
  206.       Height          =   255
  207.       Left            =   960
  208.       TabIndex        =   3
  209.       Top             =   420
  210.       Width           =   4275
  211.    End
  212.    Begin Shape Shape1 
  213.       BackColor       =   &H80000008&
  214.       BorderStyle     =   0  'Transparent
  215.       FillColor       =   &H00FFFFFF&
  216.       FillStyle       =   0  'Solid
  217.       Height          =   735
  218.       Left            =   105
  219.       Top             =   120
  220.       Width           =   735
  221.    End
  222. Option Explicit
  223. ' To use the generic About Box defined in this file, your MAK file must
  224. ' also include the module ABOUTBOX.BAS.  Just call the function
  225. ' DisplayAboutBox, passing parameters specific to your program.  DO NOT
  226. ' load the form FAB prior to calling DisplayAboutBox!
  227. Sub CommandOK_Click ()
  228.   Unload FAB
  229. End Sub
  230. Function FixAmpersand$ (ByVal Buffer$)
  231.   Dim N%
  232.   N = 1
  233.   Do Until N = 0
  234.     N = InStr(N, Buffer, "&")
  235.     If N > 0 Then
  236.       Buffer = Left$(Buffer, N) + Mid$(Buffer, N)
  237.       N = N + 2
  238.     End If
  239.   Loop
  240.   FixAmpersand = Buffer
  241. End Function
  242. Sub Form_Load ()
  243.   Dim Version&, WinVer
  244.   ' The 4 bytes of the Long returned by GetVersion encode the Windows
  245.   ' and DOS version number in this order, from low byte to high byte:
  246.   ' Windows major version number, Windows minor version number,
  247.   ' DOS minor version number, DOS major version number.
  248.   Version = GetVersion()
  249.   WinVer = ((Version And &HFF) * 100) + ((Version \ &H100) And &HFF)
  250.   ' The functions used to get the user name, company name, and FSR
  251.   ' percentage aren't available in Windows versions before 3.1.  If
  252.   ' this is an earlier version, add those items to the exclude list.
  253.   If WinVer < 310 Then
  254.     Excl = Excl Or AB_NO_USER Or AB_NO_COMPANY Or AB_NO_FSR
  255.   End If
  256.   ' If both user and company are excluded, eliminate the separator
  257.   If Excl And (AB_NO_USER Or AB_NO_COMPANY) Then
  258.     EliminateLabel 2
  259.   Else
  260.     ' Get access to USER's strings by getting a handle to USER
  261.     Dim hInstUser%
  262.     hInstUser = LoadLibrary("USER")
  263.     FreeLibrary hInstUser
  264.   End If
  265.   Dim Buffer$, Success%, N%
  266.   ' Get the User name, if wanted
  267.   If Excl And AB_NO_USER Then
  268.     EliminateLabel 3
  269.   Else
  270.     Buffer = String$(31, 0)
  271.     If LoadString(hInstUser, 514, Buffer, 30) Then
  272.       OptLabel(3).Caption = FixAmpersand(Buffer)
  273.     End If
  274.   End If
  275.   ' Get the Company name, if wanted
  276.   If Excl And AB_NO_COMPANY Then
  277.     EliminateLabel 4
  278.   Else
  279.     Buffer = String$(31, 0)
  280.     If LoadString(hInstUser, 515, Buffer, 30) Then
  281.       OptLabel(4).Caption = FixAmpersand(Buffer)
  282.     End If
  283.   End If
  284.   Dim V$
  285.   ' Show Windows version, if wanted
  286.   If Excl And AB_NO_WINVER Then
  287.     EliminateLabel 6
  288.   Else
  289.     V = "Windows " + Format$(Version And &HFF)
  290.     V = V + "." + Format$((Version \ &H100) And &HFF, "00")
  291.     OptLabel(6).Caption = V
  292.   End If
  293.   ' Show DOS version, if wanted
  294.   If Excl And AB_NO_DOSVER Then
  295.     EliminateLabel 7
  296.   Else
  297.     V = "DOS " + Format$((Version \ &H1000000) And &HFF)
  298.     V = V + "." + Format$((Version \ &H10000) And &HFF, "00")
  299.     OptLabel(7).Caption = V
  300.   End If
  301.   Dim WinFlags&
  302.   WinFlags = GetWinFlags()
  303.   ' Show Windows mode, if wanted
  304.   If Excl And AB_NO_WINMODE Then
  305.     EliminateLabel 8
  306.   Else
  307.     If WinFlags And WF_ENHANCED Then
  308.       OptLabel(8) = "386 Enhanced Mode"
  309.     ElseIf WinFlags And WF_PMODE Then
  310.       OptLabel(8) = "Standard Mode"
  311.     Else
  312.       OptLabel(8) = "Real Mode"
  313.     End If
  314.   End If
  315.   ' Show Memory, if wanted
  316.   If Excl And AB_NO_MEMORY Then
  317.     EliminateLabel 9
  318.     OptLabel(10).Visible = False
  319.   Else
  320.     Dim FreeSpace&
  321.     FreeSpace = GetFreeSpace(0)
  322.     OptLabel(10).Caption = Format$(FreeSpace \ 1024, "#,###,##0") + " KB Free"
  323.   End If
  324.   ' Show 80x87 presence, if wanted
  325.   If Excl And AB_NO_80x87 Then
  326.     EliminateLabel 11
  327.     OptLabel(12).Visible = False
  328.   Else
  329.     If WinFlags And WF_80x87 Then
  330.       OptLabel(12) = "Present"
  331.     Else
  332.       OptLabel(12) = "Absent"
  333.     End If
  334.   End If
  335.   ' Show FSRs, if wanted
  336.   If Excl And AB_NO_FSR Then
  337.     EliminateLabel 13
  338.     OptLabel(14).Visible = False
  339.   Else
  340.     OptLabel(14) = Format$(GetFreeSystemResources(GFSR_SYSTEMRESOURCES)) + "% Free"
  341.   End If
  342. End Sub
  343.